package com.shop.entity;

import java.io.Serializable;
import java.util.Objects;

//用户表
public class User implements Serializable {
    private int u_id; //用户唯一id
    private String u_name; //用户名
    private String u_pwd; //用户密码
    private int u_authority; //用户权限
    private int u_age; //用户年龄
    private String u_sex; //用户性别
    private String u_location; //用户地址（可以为空但是购物前必须填写）

    public User() {
    }

    public User(Integer u_id, String u_name, String u_pwd, Integer u_authority, Integer u_age, String u_sex, String u_location) {
        this.u_id = u_id;
        this.u_name = u_name;
        this.u_pwd = u_pwd;
        this.u_authority = u_authority;
        this.u_age = u_age;
        this.u_sex = u_sex;
        this.u_location = u_location;
    }

    public Integer getU_id() {
        return u_id;
    }

    public void setU_id(Integer u_id) {
        this.u_id = u_id;
    }

    public String getU_name() {
        return u_name;
    }

    public void setU_name(String u_name) {
        this.u_name = u_name;
    }

    public String getU_pwd() {
        return u_pwd;
    }

    public void setU_pwd(String u_pwd) {
        this.u_pwd = u_pwd;
    }

    public Integer getU_authority() {
        return u_authority;
    }

    public void setU_authority(Integer u_authority) {
        this.u_authority = u_authority;
    }

    public Integer getU_age() {
        return u_age;
    }

    public void setU_age(Integer u_age) {
        this.u_age = u_age;
    }

    public String getU_sex() {
        return u_sex;
    }

    public void setU_sex(String u_sex) {
        this.u_sex = u_sex;
    }

    public String getU_location() {
        return u_location;
    }

    public void setU_location(String u_location) {
        this.u_location = u_location;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(u_id, user.u_id) &&
                Objects.equals(u_name, user.u_name) &&
                Objects.equals(u_pwd, user.u_pwd) &&
                Objects.equals(u_authority, user.u_authority) &&
                Objects.equals(u_age, user.u_age) &&
                Objects.equals(u_sex, user.u_sex) &&
                Objects.equals(u_location, user.u_location);
    }

    @Override
    public int hashCode() {
        return Objects.hash(u_id, u_name, u_pwd, u_authority, u_age, u_sex, u_location);
    }

    @Override
    public String toString() {
        return "User{" +
                "u_id=" + u_id +
                ", u_name='" + u_name + '\'' +
                ", u_pwd='" + u_pwd + '\'' +
                ", u_authority=" + u_authority +
                ", u_age=" + u_age +
                ", u_sex='" + u_sex + '\'' +
                ", u_location='" + u_location + '\'' +
                '}';
    }
}
